home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
program
/
gcc
/
gcc270-r.lha
/
gnu
/
README-2.7.0
< prev
Wrap
Text File
|
1995-08-21
|
37KB
|
978 lines
Short: gcc v2.7.0 - C/C++/ObjC Compiler set for AmigaDOS
Type: dev/gcc
Uploader: phb@colombo.telesys-innov.fr
Author: phb@colombo.telesys-innov.fr
This is the AmigaDOS 2.7.0 GNU C/C++/Objc compiler.
The GNU C compiler is free software. See the file COPYING for copying
permission. PLEASE be sure to read README file enclosed in gcc270-readme.lha
FIRST.
===============
How to get help
===============
There's an Amiga-GCC mailing list running in Finland, read README-LIST file.
This is the preferred place to ask for help since I'm on this list and
every GCC developers also, libnix & ixemul authors, etc...
Short: send an email to listserv@lists.funet.fi, and put in body:
subscribe amiga-gcc-port your_first_name your_last_name
(insert your own first name and your own last name above)
Otherwise you can contact me at:
Philippe BRAND
Fidonet: Ramses The Amiga Flying BBS 2:320/104.0
Email: phb@colombo.telesys-innov.fr (ONLY for personal email).
WWW: www.telesys-innov.fr
Ftp: ftp.telesys-innov.fr:/pub/amigados-gnu
or /pub/incoming/uploads for uploads.
Note: I'll forward any question to this mailing-list, but please use it
directly, except when you send files, in this case send them to my ftp site.
Note 2: ftp.funet.fi mirrors my amigados-gnu tree. Using ftp.funet.fi is
preferable as they have much more bandwidth (/pub/amiga/gnu).
============
Requirements
============
- Systems:
Any Amiga (ranging from A1000 up to A4000/40, including CD-32 & SX-1) will
run AmigaDOS-GNU utilities.
- Memory:
A minimum of 4 MB of free memory is needed in order to compile small/medium
projects. More memory will be needed for large projects, such as recompiling
GCC itself.
Gigamem is known to work with GCC so *maybe* less memory will work. But in
this case, you'll need an MMU equipped Amiga (A3000,A4000/40, etc...).
VMM (Public Domain Virtual memory manager upto version 3.0, Shareware from
3.1 and up) is also known to work with GCC.
- OS:
Starting from version 2.5.x, 1.3 systems are not longer supported.
GCC runs fine on all other systems, starting from 2.04 up to 3.1 (40.68).
- Disk Space;
An installation of GCC requires the use of a hard disk. Approximately 10 MB
is required at present to install the compiler and utilities required to use
it. In addition 3 MB is required for the Commodore Developer Kit, which is
required to be able to compile AmigaDOS specific programs.
==========================
What's new in this release
==========================
2.7.0
- Read FSF NEWS-2.7.0 file included.
- As always, generic bugs fixed (see Changelog in GCC sources for details).
- FSF listing shell script suppressed.
- new as/ld/size/nm/ranlib using BFD, made by Raphael Luebbert
- as fixed, used to generate some 020 instructions while in 68000 mode.
- all programs recompiled using 2.7.0 compiler.
- new inlines headers.
- new compiler options: -mstackcheck and -mstackextend, to respectively
implement stack checking and auto-stack growing into GCC compiled programs.
- resident option is now fixed.
- new ixemul library, v41.1 (complete distribution can be found on Aminet
site).
- new libnix, v1.0 (sources can be found also on Aminet sites, in libnix
archive).
This release is dedicated in memory of Pierre Carette.
=================================
What was new in previous releases
=================================
2.6.3
- Read FSF NEWS-2.6.1 file included.
- As always, generic bugs fixed (see Changelog in GCC sources for details).
- q_anote package replaced by FSF listing shell script, need awk.
- new as/ld/size/nm/ranlib, made by Raphael Luebbert
- new environent variables GCCPRIORITY and GCCSTACK, see below.
- all programs recompiled using 2.6.3 compiler.
- mit2mot & mot2mit, convert asm syntax between Motorola and MIT syntaxes.
- all programs hold AmigaDOS compatible $VER string.
2.6.2
- internal release only.
2.6.1
- Read FSF NEWS-2.6.1 file included.
- As always, generic bugs fixed (see Changelog in GCC sources for details).
- new option -priority in gcc allowing process priority setting.
- new specs file, inlines/protos and libamiga done by Gunther Nikl. See note
below.
- new libnix version by Matthias Fleischer & Gunther Nikl.
- new ixemul version by Raphael Luebbert.
- stripc program to strip all uneccessary stuff from headers by Chris Metcalf,
submitted by Lars Hecking.
- q_anote, annotate assembly files mixing C source code, submitted by Walter
Harms (Walter.Harms@arbi.informatik.uni-oldenburg.de), written by
Mike Albaugh (albaugh@agames.com). See note below.
- new assembler, as-2.5, using new BFD (Binary File Descriptor), made by
Raphael Luebbert.
2.6.0
- Read FSF NEWS-2.6.0 file included.
- Extensive internal compiler bugs fixed (see ChangeLog in GCC sources for
details), tons of bugs fixed for C++ support.
- ld changed (see note for ld below).
- new ixemul.library, with optimized versions for accelerated Amigas, see
README-ixemul & ixemul.guide for more informations.
- new C library (libnix) disabling use of ixemul.library for generated
programs (best use for AmigaDOS specific programs). Full ANSI compliant,
see README-libnix & libnix.guide for more informations.
- revised inline headers in accordance with new ixemul.library.
- libamiga.a is now distributed with GCC-2.6.1.
- as v2.3 is included, along with a macro-assembler (gasp).
- stderrfix.o (see below) patch applied.
- Upgrade to libg++-2.6.
- GCC now supports $VER string for AmigaDOS version compatibility.
2.5.8
- Read FSF NEWS-2.5.8 file included.
- ld behaviour over symbols changed (see note below).
- added flavours so that linker will take appropriate libraries according to
gcc options (m68020 libraries/baserel libraries, etc...).
- gpc (GNU-Pascal) v1.03 added.
- all utilities recompiled with GCC-2.5.8.
- plain 68000 and 68020+68881 versions of all binaries available.
- More internal compiler bugs fixed (see ChangeLog in GCC sources for
details), some for C++ support.
- GCC-Install script fixed by Claus Deckhut (to be used with full
distribution).
- Upgrade to libg++-2.5.3.
- trace.c updated by J. Hoehle to avoid buffer overflows.
2.5.7:
- Read FSF NEWS file included.
- More internal compiler bugs fixed (see ChangeLog in GCC sources for
details), a lot for C++ support.
- Fred Fish seems to have finally found an annoying bug which prevented
to compile a resident version of GCC, or to compile resident programs. But
don't try it anyway 'cause there's still lack of library support as for now.
- Man command now works, this one was my fault (well in fact like others ;-),
fix done by Tom Haiko.
- Infoview works also, it was an internal path problem.
- libamy.a HAS TO BE RENAMED to libamiga.a because new ld won't find libamy.a
- upgrade to new C++ library v2.5.1.
=======
Authors
=======
GCC v2.2.2 port: Markus Wild
GCC v2.3.3 port: Markus Wild
GCC v2.4.5 port: Philippe Brand, Lars Hecking, Fred Fish
GCC v2.5.0 and up: Philippe Brand, Fred Fish, Leonard Norrgard
Ixemul.library: Markus Wild (original programming),
Leonard Norrgard (vinsci@nic.funet.fi),
Raphael Luebbert,
Stephan Isthesin.
Libnix: Matthias Fleischer (fleischr@izfm.uni-stuttgart.de) and
Gunther Nikl (gnikl@informatik.uni-rostock.de)
Installer Prog: Jochen Wiedmann (jochen.wiedmann@zdv.uni-tuebingen.de)
Thanks to all amiga-gcc-port mailing-list users for their reports and support
for a better AmigaDOS-GCC and documentation.
=======
Sources
=======
These archives should contain everything necessary to get you going, they
don't include sources for all tools (have a look at end of paragraph).
As stated by Richard Stallman of the FSF:
"The GPL says that any distribution of binaries must contain either the
source code or a written offer to supply source code (see the GPL for
details of what is required)."
If you're interested in the sources required to rebuild GCC, get the
gcc270-src.lha, which hold sources for GCC. Those archives should be stored
either the same ftp site you got this binary distribution from (if they're
not, tell the manager of that ftp site, as this is a requirement of the
GNU Copyright LICENSE), either at ftp.gnu.ai.mit.edu:/pub/gnu, either on
Ramses BBS (phone numbers listed below).
If you have those archives, you can skip to next paragraph. If you have
original FSF sources, you'll have to apply the GCC patch-file in src-patches/,
and configure for `amigados'. Please note that you should have at least 40 MB
left or your HD and 8 MB of memory minimum in order to rebuild GCC up to stage
3. An accelerated Amiga is welcome, as it took me 4,5 hours to generate a
single pass. So 3 passes makes 4,5 x 3 = 13,5 hours.
Sources for other tools only included as binaries are available separately
in self-contained archives, usually having their name into the archive-name.
File What
gcc270-src.lha C/C++/ObjC compiler sources & diff file
libnix-1.0.lha libnix sources and binaries
ixemul-41.1-src.lha ixemul sources and libraries
binutils-1.8.x-src.lha Sources for ld
binutils-2.5.2-src.lha Sources for ar/ranlib & diff file
make-3.74-src.lha make sources & diff file
gdbm-1.7.3-src.lha Sources for gdbm & diff file
patch-2.1-src.lha patch sources, needed to apply diff files
sed-2.05-src.lha sed sources & diff file
gawk-2.15.5-src.lha GNU awk sources & diff file
diffutils-2.7-src.lha diff utility sources & diff file
fileutils-3.11-src.lha file utilities sources & diff file
sh-utils-1.12-src.lha shell utilities sources & diff file
textutils-1.11-src.lha text utilities sources & diff file
findutils-4.1-src.lha find sources & diff file
grep-2.0-src.lha grep sources & diff file
bison-1.22-src.lha bison (yacc replacement) sources & diff file
flex-2.4.7-src.lha flex (lex replacement) sources & diff file
texinfo-3.1-src.lha texinfo (includes makeinfo) sources & diff file
gzip-1.2.4-src.lha gzip sources & diff file
tar-1.11.2-src.lha gtar sources & diff file
cpio-2.3-src.lha cpio sources & diff file
gdbm-1.7.3-src.lha database manip. library sources & diff file
termcap-1.2-src.lha termcap library sources & diff file
libm-5.6-src.lha BSD mathematic library sources & diff file
NOTE:
All sources archives are Amiga ready, and Amiga specific diff file located
in 'amiga' directory. To recompile a tool, just run a 'configure amigados'
then a 'make'.
Exceptions are libnix and ixemul which have their own archives, both binary &
sources. On Aminet sites, libnix & ixemul in /pub/amiga/dev/gcc.
=====
Where
=====
**** All GNU sources & binaries are available on:
- ftp.telesys-innov.fr, primary Amiga-GNU FTP site, and its mirror ftp.funet.fi
which is MUCH faster than my own site. Please use it at first choice.
in /pub/amigados-gnu
- Aminet sites (wuarchive.wustl.edu and mirrors such as ftp.luth.se)
in /pub/amiga/dev/gcc
- Ramses The Amiga Flying BBS +33-1-45845623 USR V.everything 2400-33600
+33-1-53791199 USR V.everything 2400-33600
+33-1-53791200 USR Sportster V32b 2400-14400
+33-1-53791219 USR V.everything 2400-33600
in Topic "Development", Area "Gcc" (File Area 156).
- FreshFish CDs from Fred Fish Amiga Library Services
in :GNU/bin, :GNU/src, :GNU/lib dirs. 610 N. Alma School Road, Suite 18
Chandler, AZ 85224-3687
USA
FAX: (602) 491-0048
VOICE: (602) 491-0442
**** GNU source code is available on:
- same FTP site you've taken these archives
- gnu.prep.ai.mit.edu 18.71.0.38
in /pub/gnu
- Ramses The Amiga Flying BBS
in Topic "AmigaUnix/Unix/Linux/NetBSD", Area "Gnu Source Code"
- FreshFish from Fred Fish
in :GNU/src
======
Layout
======
GCC-2.7.0 is split up into 15 archives:
gcc270-readme.lha holds readmes files (include installation notes).
gcc270-base.lha basic GCC distribution, hold necessary files.
gcc270-inclib.lha headers and libraries.
gcc270-c.lha C compiler.
gcc270-c-020.lha 68020 version of C compiler.
gcc270-c++.lha C++ compiler, headers and libraries.
gcc270-c++-020.lha 68020 versions of C++ compiler.
gcc270-objc.lha Objective-C compiler, header and libraries.
gcc270-objc-020.lha 68020 versions of Objective-C compiler.
gcc270-doc.lha GCC AmigaGuide(tm) documents & manpages.
gcc270-utils.lha Useful utilities needed for development.
gcc270-utilsdoc.lha Utilities documentation (guide & manpages).
gcc270-texi.lha All Texinfo documents.
gcc270-diffs.lha Diff files for all binaries.
gcc270-src.lha Source for GCC-2.7.0 plus diff file.
Name What Where
---- ---- -----
COPYING GNU LICENSE, read!! All archives
COPYING.LIB GNU LIBRARY LICENSE, read!! All archives
README-2.7.0 this file All archives
NEWS-2.7.0 What's new in GCC-2.7.0 gcc270-base
Installer Commodore installer utility gcc270-base
GCC-Install Installer script to configure GCC All archives
envarc/ global environment variables you should
have set when using this programming gcc270-base
environment
include/ non-Amiga specific C/C++ headers gcc270-inclib
os-include/proto Amiga specific protos headers. gcc270-inclib
os-include/inline Amiga specific inline C headers. Add gcc270-inclib
Commodore headers!!
os-lib/ Amiga specific libraries gcc270-base
guide/ Docs in AmigaGuide(tm) format gcc270-doc
man/ this is the root for tons of man pages gcc270-doc
bin/ this is /bin, and contains all gcc270-c
binaries of this distribution that gcc270-c++
are meant to be directly invoked by gcc270-utils
the user (contrary to the executables
in lib/gcc-lib/, that are meant to be
invoked by a driver program like gcc)
lib/ normal (not base relatives) libraries gcc270-inclib
lib/libm020/ normal 68020 libraries gcc270-inclib
lib/libb/ base relatives libraries gcc270-inclib
lib/libb/libm020/ base relatives using 68020 libraries gcc270-inclib
lib/libnix/ Non-ixemul libraries gcc270-inclib
lib/libm020/libnix/ Non-ixemul 68020 libraries gcc270-inclib
lib/libb/libnix/ Non-ixemul base relatives libraries gcc270-inclib
lib/libb/libm020/libnix Non-ixemul base relatives 68020 libs gcc270-inclib
lib/gcc-lib/ home of compilers called by gcc gcc270-c
gcc270-c++
gcc270-objc
ixpipe/ a pipe handler needed by the library gcc270-base
libs/ ixemul.library gcc270-base
rexx/ ARexx wrappers for gcc and g++ gcc270-base
src-patches/ source patches gcc270-diffs
geninline/ Perl scripts to generate inline headers gcc270-inclib
and -lamy glue
==============
Inline-Headers
==============
Since I'm not able to redistribute Amiga header files, you will have to get
them directly from Commodore, unless you're an official registered Amiga
developer. You can also find Development Kit on FreshFish CD-Roms.
In order to generate inline-headers, follow these steps (provided Amiga
headers and fd files are in os-include). If you are compiling for Kickstart
3.1 or less, you don't have to generate them, inlines are provided with
the distribution.
1) First method:
CLI> stack 100000
CLI> Assign INCLUDE: GCC:os-include
CLI> Assign FD: INCLUDE:fd
CLI> Makedir INCLUDE:inline
CLI> cd USR:bin/geninline
CLI> gen31
This will create all inline-headers. If you have 2.0 headers, use gen20
instead, if you have 3.0, use gen30, if you have 6.4, send it to me ;-)
NOTE: perl scripts do not handle correctly AmigaDOS include files, which
seems to mean they are somewhat broken. If someone could work on this...
2) Second method:
Use fd2inline, which you can find on Aminet in dev/gcc.
===============
Amiga Libraries
===============
Starting from 2.6.0 an AmigaDOS compliant library is provided, thanks to
libnix authors (Matthias Fleischer and Gunther Nikl).
Anyway if you want to rebuild one, there are two methods:
1) Using hunk2gcc; the AmigaDOS object converter made by Markus Wild. To
achieve this, simply grab a copy of latest amiga.lib (from Commodore
Development Kit) and make a new directory where you want your converted
object files to go, cd into it, and enter
hunk2gcc amiga.lib [..further libs if you like..]
This generates an a.out object file for every program unit present in the
hunk file (in this case, from amiga.lib).
As the final step convert all those files into an a.out style library by
issuing:
ar qc libamiga.a obj.*
ranlib libamiga.a
The ranlib run builds a symbol table in the archive, and makes accesses to
the library much faster.
2) Creating a libamiga.a library with libnix is fairly easy, but takes some
time. Just decompress sources.lha from libnix distribution and run a
'make libamiga.a'.
NOTE:
As long as you make no AmigaDOS specific calls, you can create a dummy
library using:
cat "int dummy;" >dummy.c
gcc -c dummy.c
ar crv libamiga.a dummy.o
mv libamiga.a gcc:lib
A small libamiga.a (dummy) is also provided with libnix.
====================
Upgrade Installation
====================
- You will at first have to decide if you want to keep your existing
GCC compiler or not. This might sound silly, but it is in fact possible.
- I want to keep older GCC compiler
CLI> cd GNU:lib
CLI> rename libgcc.a GNU:lib/gcc-lib/mc68000-cbm-amigados/2.6.3
(note: replace 2.6.3 with your GCC version)
CLI> rename libb/libgcc.a GNU:lib/gcc-lib/mc68000-cbm-amigados/2.6.3/libb
CLI> rename libm020/libgcc.a GNU:lib/gcc-lib/mc68000-cbm-amigados/2.6.3/libm020
CLI> cd GNU:bin
CLI> rename gcc gcc-2.6.3
CLI> rename gccv gccv-2.6.3
- I don't care about previous versions
CLI> delete GNU:lib/gcc-lib/mc68000-cbm-amigados/2.6.3 all quiet
Proceed then to "Distribution Installation" below, for
mandatory archives only.
=========================
Distribution Installation
=========================
NOTE: you MUST at least unpack gcc270 base, inclib and c parts. Other
archives are optional.
- You need first to create a directory gnu on your hard-disk and unarchive
first part:
CLI> cd place_with_lot_of_space
CLI> makedir gnu
CLI> lha x gcc270-base.lha
- Now you have to append gnu/s/user-startup to your s:user-startup file
(replace Devel:GNU by your own gnu path). Execute it in order to get new
assigns:
CLI> execute gnu/s/user-startup
- Copy gnu/envarc to ENVARC:
CLI> copy gnu/envarc/#? ENVARC:
- GCC libraries and headers:
CLI> lha x gcc270-inclib.lha
- C-compiler is needed so unarchive C compiler part (Users with
accelerated Amigas can unarchive gcc270-c-020 part instead) :
CLI> lha x gcc270-c.lha (or gcc270-c-020)
- If you want to have GCC documentation on-line, unarchive doc part:
CLI> lha x gcc270-doc.lha
- If you want to do C++, unarchive C++ part (Users with
accelerated Amigas can unarchive gcc270-c++-020 part instead) :
CLI> lha x gcc270-c++.lha (or gcc270-c++-020)
Please note that 68020 versions have '.020' extension in GNU:bin.
- If you want to do Objective-C, unarchive Objective-C part (Users with
accelerated Amigas can unarchive gcc270-objc-020 part instead) :
CLI> lha x gcc270-objc.lha (or gcc270-objc-020)
- If you want additional utilities (recommended for Unix compatibility),
unarchive utils part:
CLI> lha x gcc270-utils.lha
- If you want all utilities documentation on-line, unarchive utils-doc
part:
CLI> lha x gcc270-utilsdoc.lha
- Because some programs are normally links to others, please run script:
CLI> sh /gnu/s/restorelinks
Or if you don't want to use makelink but rather copy file, run script:
CLI> sh /gnu/s/restorelinks copy
- If you want to rebuild all distribution, you'll have to unarchive
diff part:
CLI> lha x gcc270-diffs.lha
- If you want to build Postscript files for GCC documentation, unarchive
texinfo part:
CLI> lha x gcc270-texi.lha
- Now skip to next paragraph and happy compiling!
NOTE: new version of ixemul.library is provided, make sure you don't have
another copy somewhere which may conflict with GCC.
=============================
Your first C program with GCC
=============================
What about a nice Hello World ?
#include <stdio.h>
main()
{
printf("Hello World!\n");
}
This was pretty simple ;-) Now we have to compile it.
There's a lot of options in GCC but the simplest way to compile this would
be:
CLI> gcc -o hello hello.c
Simple?
Here's more options.
Target processor for Motorola family:
You can compile plain 68000 code, 68020, 68030, 68040, 68881 (have a look at
GCC documentation, either in info or AmigaGuide format, chapter Invoking
GCC/SubModel Options/M680X0 Options for Motorola specific compilation flags).
CLI> gcc -m68020 -m68881 -o hello hello.c
This will compile your programs using 68020 code and direct calls to
math-processor, and will link with accelerated libraries, located in
GCC:lib/lib020.
Optimization:
Either you don't want optimization, or you can provide -O, which will
optimize your code, or if you really want top optimization, use -O2 flag
(for more discussion about optimization, read info or AmigaGuide doc chapter
Invoking GCC/Optimize Options). There's now even a -O3 optimization option,
which will go even further.
CLI> gcc -O2 -o hello hello.c
You'll never have a "Hello World" program running so fast ;-)
Code generation:
Perhaps you want to generate resident programs.
Flag is -resident, at compile and link stage.
CLI> gcc -resident -o hello hello.c
Of course you can mix all options, resulting in:
CLI> gcc -O2 -m68020 -m68881 -resident -o hello hello.c
This will make a 68020+68881 executable highly optimized and resident.
IMPORTANT:
If you only use AmigaDOS functions or you don't want to use ixemul for
philosophical reasons, you can get rid of ixemul.library with:
CLI> gcc -noixemul -o foobar foobar.c
provided you have libnix distribution (included with 2.6.0 and up
distributions).
================
Ixemul vs Libnix
================
Starting with 2.6.1 version of AmigaDOS-GCC, two C libraries are provided.
First one is using ixemul.library Amiga shared-library at run-time. This
library makes it possible to easily convert Unix(tm) programs to AmigaDOS,
and made for example possible GCC on AmigaDOS. Have a look at ixemul.guide
for further informations.
Second one is an ANSI-C compliant library which is better suited for
AmigaDOS specific development, thus not using any Unix specific routines.
Libnix is a static (i.e. link) library for GCC 2.3.3 or above.
It's not a replacement for ixemul.library (though it's possible to
recompile most of the GCC environment with libnix) but a good thing
for Amiga specific development on GCC:
* It's mostly compatible to SAS's way of handling things, i.e.
you get even an automatic shared library opening feature and
some other things you may miss in ixemul.library.
This also means it's ANSI compliant.
* It doesn't need any shared libraries other than normal Amiga OS ones.
* It is not copyrighted by the FSF. Therefore you neither need
to include sources nor objects together with your executable.
(read the GLGPL _before_ flaming on this statement)
* And it's short! I was able to compile a 492 byte 'hello, world'
using normal main.
* It uses OS 2.0 features whenever necessary.
Note that you can develop AmigaDOS specific programs with ixemul.library,
but at the cost of an extra 200 kB of memory taken by shared library.
To cut it short:
Use ixemul.library for porting Un*x programs, libnix for compiling
Amiga-only programs and GCC becomes one of the best Amiga compilers.
===============================
Redirection with ixemul.library
===============================
A common problem seen with AmigaDOS-GCC is bad redirection to stderr.
The fact is that ixemul.library takes stderr from the pr_CES field
in the process structure. The field was added in 2.0. If the field
is not set, then ixemul uses stdout, instead. The trouble is that this
field must be set by the shell, and the only shell that does so is
WShell!
The rationale behind ixemul.library working this way is that
"run <NIL: >NIL: cmd" will detach your process from the terminal, so
that you can close the initial CLI window after startup.
In any case, there is a workaround for the problem that was posted to the
list a while back: compile your main program using the -Dmain=mymain
option, then link with stderrfix.o to provide the actual main that will
do the magic that creates an stderr stream that is different from
stdout. Along with the C version a C++ version is included and was used to
compile groff.
Thanks to Kriton Kyrimis for this explanation and patch.
stderr fixes can be found in GNU:stderrfix (srcs-) and GNU:lib (.o files).
=====
ARexx
=====
The provided ARexx scripts have been contributed by Loren J. Rittle.
If you like ARexx, they're an alternate way of calling GCC. They
automatically make sure you're using a large enough stack setting, and
enable you to compile C++ programs with less obscure options.
===============
Gcc versus gccv
===============
gccv stands for a gcc using vfork() to spawn a new process, and then calling
the new execve() function in ixemul.library to call its subcompilers. Gcc
continues to using the more system friendly RunCommand() function in
dos.library to start subcompilers. Gccv has the advantage of being able to
work with interprocess pipes, thus (provided you have the memory ;-)), you're
able to do
gccv -pipe your_program.c
causing the preprocessor (cpp), the C-compiler (cc1) and the assembler (as)
to run at the same time, passing intermediate files through internal pipes
instead of using temporary files.
As long as you don't want that feature (OK, playing with certain make tools
also requires gccv) you're safe using gcc.
==========
Stack size
==========
You need to have a stack size of 50000 in order to compile with GCC. This
should be enough for most projects. Note than while recompiling GCC with
itself it has taken more than 300 kB of stack. Stack usage can grow due to
source complexity.
Don't be afraid of it.
To set the stack size, see the AmigaDOS Command 'stack'.
To use ar and/or ranlib, 50 kB is the minimum acceptable stack. You should
have a much larger stack, if you use larger libraries.
Starting with 2.6.3 a new environment variable, GCCSTACK, enables gcc to
read this variable and set stack upon startup. Thus now no need to set stack
to huge values, only gcc/ld/cpp/cc1#? will automatically set new stack,
according to GCCSTACK variable.
Simply commit a:
setenv GCCSTACK value
to set gcc stack to value.
Benefits: Huge memory savings.
========
Priority
========
Starting also with 2.6.3 a new environment variable, GCCPRIORITY, let you
specify a default process priority for GNU compiler. Setting it to -1 enable
your Amiga to do something else while compiling :-)
===========
C++ headers
===========
With AmigaDOS it makes no difference whether a name has capital or
lower-case letters in names when finding files (i.e. it is case
insensitive), you'll certainly run into problems with some headers,
including String.h and normal string.h. My suggestion for now is to add to
C++ "faulty" header file name an "_" in front of it, thus String.h would
become _String.h. Sorry for the inconvenience. (Thanks to Dirk Nehring for
reminding me about this annoying "feature").
=======
Patches
=======
Includes:
Jorg Hoehle
hoehle@inf-wiss.uni-konstanz.de
There is a conflict between the Amiga and the UNIX definition of the
timeval structure. Markus Wild proposed in GCC233 to patch the Amiga
devices/timer.h file so that it loads the UNIX sys/time.h file (and
thus tons of other files) (see os-include/devices/timer.mwild.path). I
suggest that sys/time.h and devices/timer.h be modified to detect each
other and use whichever structure was declared first (see
os-include/devices/timer.jch.patch). The supplied include/sys/time.h
file works this way. You can apply the patches with the program patch
or by hand. The original devices/timer.h file is copyrighted by
Commodore-Amiga and not included, but here is the patch:
+ #ifndef _SYS_TIME_H_
+ /* Use whatever was included first, standard (sys/time.h) or Amiga
+ * includes (jch). */
struct timeval {
ULONG tv_secs;
ULONG tv_micro;
};
+ #else
+ #define tv_secs tv_sec
+ #define tv_micro tv_usec
+ #endif
The sys/types.h defined BPTR causing conflicts with Amiga includes. I
removed the BPTR definition from sys/types.h and sys/proc.h. In
GCC233, there was no such definition either.
I moved the ixemul.h file from include/ to the ixemlib/library/
directory. The ixemlib/ directory could contain the ixemul.library
sources. In the ixemul source tree, ixemul.h is found in the library/
directory. Furthermore I patched it so that it is now able to compile
a working ixconfig. It was broken (because of the broken ixemul.h) in
GCC252/3/4. It previously worked in GCC233 but didn't provide the -e
option. The ixemlib/library/version.h is an empty fake. I don't have a
newer ixemul.h file.
There's yet another minor patch I'd like to suggest:
*** include/stdlib.h.orig Mon Aug 10 15:28:54 1992
--- include/stdlib.h Fri Dec 09 17:12:38 1993
***************
*** 72,76 ****
--- 72,80 ----
void *calloc __P((size_t, size_t));
div_t div __P((int, int));
+ #if 0
void volatile exit __P((int));
+ #else /* new ANSI-C interpretation */
+ typedef void exit_t __P((int)); volatile exit_t exit;
+ #endif
void free __P((void *));
char *getenv __P((const char *));
===============
Ld (GNU linker)
===============
Starting from 2.5.8 release, ld behaviour over symbols has changed. Default
is now to strip all symbols from generated executable ONLY if environment
variable LDSTRIP is set (to whatever you want). Otherwise, '-s' flag will
strip symbols, as usual.
Also packing of uninitialized data will be done automatically if LDSHORTDATA
is set (to whatever you want).
Ld also knows about -chip and -fast keywords, gcc will soon handle them
directly.
Ld is using now flavours, which are generated depending on gcc flags:
Gcc option Flavor passed to ld
-m68020 -fl libm020
-noixemul -fl libnix
-resident -fl libb
Thus ld when searching for libraries, adds those flavours to the library
search path, in alphabetical order. Normal search path is /gnu/lib, and
if for example you want to compile using -m68020 -noixemul ld will look
for libgcc.a in:
/gnu/lib/libm020/libnix
first, then it will reduce flavours, one by one, if it can't find required
library in flavour's expanded path. This means that it will try to find
libgcc.a in:
/gnu/lib/libm020
and in /gnu/lib/. Because libgcc.a exists in /gnu/lib/libm020, ld will take
this one.
There is as for now 8 possibilities:
Flavors Search path
libb libm020 libnix
0 0 0 /gnu/lib/ normal
0 0 1 /gnu/lib/libnix/ non-ixemul
0 1 0 /gnu/lib/libm020/ normal 68020
0 1 1 /gnu/lib/libm020/libnix/ non-ixemul 68020
1 0 0 /gnu/lib/libb/ baserel
1 0 1 /gnu/lib/libb/libnix/ baserel non-ixemul
1 1 0 /gnu/lib/libb/libm020/ baserel 68020
1 1 1 /gnu/lib/libb/libm020/libnix/ baserel 68020 non-ix
Using this approach makes adding flavours pretty easy, if someone wants for
example to add 68881 libraries, a new flavour will have to be created,
libm881, and thus the maximum flavour search path level would be:
/gnu/lib/libb/libm020/libm881/libnix, which can be translated to English as:
"I want a base-relative library compiled using Motorola 68020 and coprocessor
68881, not using ixemul.library".
=====================
GCC and its "pragmas"
=====================
From Gunther Nikl:
Accessing operating-system functions on the Amiga requires to pass arguments
in specific processor registers. C, however, uses a different calling
convention: It pushes all arguments in reverse order onto the stack, calls
the function and finally removes the arguments from the stack by simply
correcting the stack pointer.
One solution to interface C and the calling convention for the system
functions are so called "glue"-functions that convert arguments passed on
the stack into the OS-function convention. These glue routines are located
for all system libraries in a link library named libamiga.a. Obviously this
method is inefficient. Most Amiga C-compilers have the capability of in-line
calls to OS functions using a C language extension "#pragma". The format of
a pragma statement and file names differ from compiler to compiler. GCC
supports in-line calls too but not with pragmas. the GCC solution is based
on the fact that GCC is able to integrate small functions into the caller.
This method is known from C++ as "inlining". Thus functions that are
declared "inline" (preferable in conjunction with the keyword static or
extern but see the next chapter) get integrated. As you can see writing
programs that compile with several compilers and use its capability of making
in-line calls to libraries is a tricky thing.
To get programs more portable between Amiga C-compilers a new set of include
files would be helpful that hide the different methods for in-line calls
from the user. These files are located in a drawer called proto e.g.
"proto/exec.h". Instead of writing (only an example!):
#include <clib/exec_protos.h>
#ifdef __GNUC__
#include <inline/exec.h>
#endif
now the following should be used:
#include <proto/exec.h>
to achieve the same result! Nice, isn't it? The general rule for the all
files is:
#include <proto/xxx.h>
with "xxx" replaced with the first part of a clib proto-headers name e.g.
"exec_protos.h" becomes "exec.h"
In general each file first includes its function prototype header then the
compiler specific "pragma" header and finally declares the library base
extern. The GCC files are in the following format:
(1) include some C= headers to prevent errors with GCC
(2) include the function prototypes from the clib drawer
(3) include the inline header if this is not disabled and if
optimizing
(4) declare the library base extern if its not disabled
Step 3 will only be executed if GCC is optimizing. Otherwise the compiler
won't integrate any function. Even when optimizing it could be not desired
to include the inline header because it requires some amount of memory and
the compile time enlarges significantly. Therefore step 3 can be disabled
with:
- a define on the command line "-D__NOINLINES__"
or
- a define before the proto headers are included "#define __NOINLINES__"
Declaring the library base as an external variable can disabled with a
define in the same way. The define is called "__NOLIBBASE__". This define
can be useful if its not desired to have the library base declared extern.
Using the new proto headers has some advantages then using the clib and
inline files by itself:
(1) better compatibility with SAS/C. It should be much easier to compile
programs developed for SAS/C with GCC - almost ;) no need to adjust
includes
(2) almost ;) optimal code because depending on the optimization level
the best suited include set will be used
(3) internal compiler specific requirements are hidden from the user
For the exec.library the proto header has one additional goodie: it
"implements" SAS/C "_USEOLDEXEC_". Defining this forces to evaluate the
absolute address 4 every time the library base for the exec.library is
required. In this case no global library base is necessary but it must be
noted that programs compiled with this option enabled can have performance
problems because AbsExecBase is located in Chip-Memory. Be aware: if using
_USEOLDEXEC_ its *NOT* legal to declare or define SysBase! If you do so
strange things may happen ... Please note that some function in libamiga.a
require a global "SysBase" so that those functions cannot be used.
Some problems still remain but these restrictions come from the inline
technique. Library bases have to be global due to the nature of the
inlines. SAS/C, however, is able to use local variables or structure
elements as library bases. In this case the library bases has to be made
global for GCC.
==============
Inline headers
==============
One major advantage of GCC is its ability to integrate simple functions into
the caller. To direct the compiler to inline a function the keyword "inline"
in combination with "static" or "extern" can be used. Previous version of the
inlines used static in the definition. This had the effect that functions
compiled to assembler if optimization is disabled. The new inline headers use
extern definitions. Functions defined inline and extern can be considered as
macros. That means the definition is only used for inlining thus requiring
linking with a library containing stubs.